﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Loan.Master" AutoEventWireup="true" CodeBehind="Summary.aspx.cs" Inherits="CRMWeb.Pages.Summary" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:content id="Content2" contentplaceholderid="ContentPlaceHolder1" runat="server">
    <div class="easyui-panel" title="Loan Parties" style="width: auto; height: 200px;">
        <div id="toolbarSummary">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="openDialogNewParty()">New</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-edit" plain="true" onclick="openDialogEditParty()">Edit</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="deleteParties()">Delete</a>
        </div>
        <table id="dgParties"   style="width: auto;" autorowheight="true"
            data-options="pageSize:10" rownumbers="true" fitcolumns="true" singleselect="true">
            <thead>
                <tr>
                    <th field="Title" width="10"></th>
                    <th field="FirstName" width="40">Party</th>
                    <th field="Mobile" width="40">Mobile</th>
                    <th field="HomePhone" width="30">Phone</th>
                    <th field="Email" width="50">Email Address</th>
                    <th field="DateBirth" width="30" data-options="formatter:formatDateBirth">DOB</th>
                    <th field="Street" width="60">Address</th>
                </tr>
            </thead>
        </table>
    </div>
    <div id="tabSummary" class="easyui-tabs" style="width: auto; height: 600px;">
        <%-- <div id="pnlParties" title="Parties" runat="server" data-options="href:'Parties.aspx'" style="padding: 10px; width: auto; height: auto;">
        </div>--%>
        <div id="pnlContract" title="Setup" data-options="href:'Contract.aspx'" style="padding: 10px; width: auto; height: auto;">
        </div>
        <div id="pnlRepayment" title="Repayment" data-options="href:'Repayment.aspx'" style="padding: 10px; width: auto; height: auto;">
        </div>
        <div id="pnlSecurity" title="Security" runat="server" data-options="href:'Security.aspx'" style="padding: 10px; width: auto; height: auto;">
        </div>
    </div>

    <input type="hidden" id="hdnloanid" />
    <input type="hidden" id="hdnContactId" />
    <input type="hidden" id="hdnApp_Id" />

    <div id="dlgAddParty" class="easyui-dialog" style="width: 850px; height: 550px; padding: 5px;" closed="true" center="true">
        <div class="topform_section">
            <div class="equal_div" style="width: 45%; margin-right: 2%; margin-left: 2%">
                <div class="ftitle" style="width: 320px">PARTIES</div>
                <div class="fitem">
                    <label>Title:</label>
                    <input id="txtTitle" style="width: 150px;" class="easyui-validatebox" name="Title" />
                </div>
                <div class="fitem">
                    <label>Name:</label>
                    <input id="txtName" style="width: 150px; background-color: LightGray;" class="easyui-validatebox" name="Name" disabled="disabled" />
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#dlgFullName').dialog('open')">...</a>
                </div>
                <div class="fitem">
                    <label>Role:</label>
                    <input id="txtRole" style="width: 150px;" class="easyui-validatebox" name="Role" />
                </div>
                <div class="fitem">
                    <label>Relationship:</label>
                    <input id="txtRelationship" style="width: 150px;" class="easyui-validatebox" name="Relationship" />
                </div>
                <div class="fitem">
                    <label>DOB:</label>
                    <input id="txtDOB" name="DOB" class="easyui-datebox" data-options="formatter:formatLoanDate" style="width: 90px;" />
                </div>
                <div class="ftitle" style="width: 320px">CONTACT DETAILS</div>
                <div class="fitem">
                    <label>Mobile Phone</label>
                    <input id="txtMobilePhone" style="width: 150px;" class="easyui-validatebox" name="MobilePhone" />
                </div>
                <div class="fitem">
                    <label>Home Phone:</label>
                    <input id="txtHomePhone" style="width: 150px;" class="easyui-validatebox" name="HomePhone" />
                </div>
                <div class="fitem">
                    <label>Work Phone:</label>
                    <input id="txtWorkPhone" style="width: 150px;" class="easyui-validatebox" name="WorkPhone" />
                </div>
                <div class="fitem">
                    <label>Fax Number:</label>
                    <input id="txtFaxNumber" style="width: 150px;" class="easyui-validatebox" name="FaxNumber" />
                </div>
                <div class="fitem">
                    <label>Email Address 1:</label>
                    <input id="txtEmail1" style="width: 150px;" class="easyui-validatebox" name="EmailAddress1" />
                </div>
                <div class="fitem">
                    <label>Email Address 2:</label>
                    <input id="txtEmail2" style="width: 150px;" class="easyui-validatebox" name="EmailAddress2" />
                </div>
                <div class="fitem">
                    <label>Home Address:</label>
                    <input id="txtHomeAddress" style="width: 150px; background-color: LightGray;" class="easyui-validatebox" name="HomeAddress" disabled="disabled" />
                    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#dlgHomeAddress').dialog('open')">...</a>
                </div>
                <div class="fitem">
                    <label>Postal Address:</label>
                    <input id="txtPostalAddress" style="width: 150px;" class="easyui-validatebox" name="PostalAddress" />
                </div>
            </div>
            <div class="equal_div" style="width: 40%;">
                <div class="fitem">
                    <label>Income Type:</label>
                    <select id="txtIncomeType" class="easyui-combobox" data-options="panelHeight:'auto',editable:false" name="IncomeType" style="width: 150px;">
                        <option value="Employee">Employee</option>
                        <option value="Self Employed">Self Employed</option>
                    </select>
                </div>
                <div id="selfemployed" style="display: none">
                    <div class="fitem">
                        <label>Type of Entity:</label>
                        <input id="txtTypeofEntity" style="width: 150px;" class="easyui-validatebox" name="TypeofEntity" />
                    </div>
                    <div class="fitem">
                        <label>Business Name:</label>
                        <input id="txtBusinessName" style="width: 150px;" class="easyui-validatebox" name="BusinessName" />
                    </div>
                    <div class="fitem">
                        <label>ABN:</label>
                        <input id="txtABN" style="width: 150px;" class="easyui-validatebox" name="ABN" />
                    </div>
                    <div class="fitem">
                        <label>Nature of Business:</label>
                        <input id="txtNatureofBusiness" style="width: 150px;" class="easyui-validatebox" name="NatureofBusiness" />
                    </div>
                    <div class="fitem">
                        <label>Phone:</label>
                        <input id="txtPhone" style="width: 150px;" class="easyui-validatebox" name="Phone" />
                    </div>
                    <div class="fitem">
                        <label>Address:</label>
                        <input id="txtAddress" style="width: 150px;" class="easyui-validatebox" name="Address" />
                    </div>
                </div>
                <div id="employee">
                    <div class="fitem">
                        <label>Employer:</label>
                        <input id="txtEmployer" style="width: 150px;" class="easyui-validatebox" name="Employer" />
                    </div>
                    <div class="fitem">
                        <label>Occupation:</label>
                        <input id="txtOccupation" style="width: 150px;" class="easyui-validatebox" name="Occupation" />
                    </div>
                    <div class="fitem">
                        <label>Job Position:</label>
                        <input id="txtJobPosition" style="width: 150px;" class="easyui-validatebox" name="JobPosition" />
                    </div>
                    <div class="fitem">
                        <label>Employer Phone:</label>
                        <input id="txtEmployerPhone" style="width: 150px;" class="easyui-validatebox" name="EmployerPhone" />
                    </div>
                    <div class="fitem">
                        <label>Contact Person:</label>
                        <input id="txtContactPerson" style="width: 150px;" class="easyui-validatebox" name="ContactPerson" />
                    </div>
                    <div class="fitem">
                        <label>Work Address:</label>
                        <input id="txtWorkAddress" style="width: 150px;" class="easyui-validatebox" name="WorkAddress" />
                    </div>
                </div>
                <div class="ftitle" style="width: 400px">NEXT OF KINS</div>
                <table style="width: 100%;">
                    <tr>
                        <td>
                            <div class="fitem">
                                <label>Name:</label>
                                <input id="txtKinsName" style="width: 100px;" class="easyui-validatebox" name="KinsName" />
                            </div>
                        </td>
                        <td>
                            <div class="fitem">
                                <label>Relationship:</label>
                                <input id="txtKinsRelationship" style="width: 100px;" class="easyui-validatebox" name="KinsRelationship" />
                            </div>
                        </td>
                        <td>
                            <div class="fitem">
                                <label>Contact Number:</label>
                                <input id="txtContactNumber" style="width: 100px;" class="easyui-validatebox" name="KinsContactNumber" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div class="fitem">
                                <label>Notes:</label>
                            </div>
                            <textarea id="txtNotes" name="Notes" style="width: 100%; height: 120px;"></textarea>
                        </td>
                    </tr>
                </table>

            </div>
        </div>
        <div class="topform_section">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="$('#dlgAddParty').dialog('close')" style="float: left">Cancel</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-ok" onclick="savePartyDetails()" style="float: right">Save</a>

        </div>
    </div>
    <div id="dlgFullName" title="Fullname Information" class="easyui-dialog" style="width: 300px; height: 200px; padding: 10px" closed="true" buttons="#dlgFullName-buttons">
        <div class="fitem">
            <label style="width: 120px;">First Name:</label>
            <input id="txtFirstName" type="text" name="FirstName" class="easyui-validatebox" />
        </div>
        <div class="fitem">
            <label style="width: 120px;">Middle Name:</label>
            <input id="txtMiddleName" type="text" name="MiddleName" class="easyui-validatebox" />
        </div>
        <div class="fitem">
            <label style="width: 120px;">Surname:</label>
            <input id="txtSurName" name="SurName" type="text" class="easyui-validatebox" />
        </div>
        <div id="dlgFullName-buttons">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="setFullName()">Save</a>
        </div>
    </div>
    <div id="dlgHomeAddress" title="Home Address Information" class="easyui-dialog" style="width: 300px; height: 240px; padding: 10px" closed="true" buttons="#dlgHomeAddress-buttons">
        <div class="fitem">
            <label style="width: 120px;">Street:</label>
            <input id="txtStreet" type="text" name="Street" class="easyui-validatebox" />
        </div>
        <div class="fitem">
            <label style="width: 120px;">Suburb:</label>
            <input id="txtSuburb" type="text" name="Suburb" class="easyui-validatebox" />
        </div>
        <div class="fitem">
            <label style="width: 120px;">State:</label>
            <input id="txtState" name="State" type="text" class="easyui-validatebox" />
        </div>
        <div class="fitem">
            <label style="width: 120px;">Post Code:</label>
            <input id="txtPostCode" name="PostCode" type="text" class="easyui-validatebox" />
        </div>
        <div id="dlgHomeAddress-buttons">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="setHomeAddress()">Save</a>
        </div>
    </div>

   <script type="text/javascript">
       $(document).ready(function () {
           //FillParties();
           $('#dgParties').datagrid({
               data:[]
           });
           fnLeftNavSelected('lnkSummary');
       });

       function FillParties() {
           $('#dgParties').datagrid({
               url: '/WebServices/AM/Summary.ashx?LoanID=' + getQuerystring('LoanID', ''),
               onLoadSuccess: function (data) {
                   var rows = $('#dgParties').datagrid('getRows');
                   if (rows.length > 0) {
                       $('#dgParties').datagrid('selectRow', 0);
                   }
               },
               onDblClickRow: function (index, rowdata) {
                   if (rowdata == "undefined") {
                   }
                   else {
                       window.location.href = "/Pages/Contact/ContactDetail.aspx?contact_id=" + rowdata.ContactID;
                   }
               }
           });
       }


       function formatDateBirth(value, row) {
           if (value == null)
               return '';
           var date = new Date(value);
           var y = date.getFullYear();
           var m = date.getMonth() + 1;
           var month = '';
           switch (m) {
               case 1:
                   month = 'Jan';
                   break;
               case 2:
                   month = 'Feb';
                   break;
               case 3:
                   month = 'Mar';
                   break;
               case 4:
                   month = 'Apr';
                   break;
               case 5:
                   month = 'May';
                   break;
               case 6:
                   month = 'Jun';
               case 7:
                   month = 'Jul';
                   break;
               case 8:
                   month = 'Aug';
                   break;
               case 9:
                   month = 'Sep';
                   break;
               case 10:
                   month = 'Oct';
                   break;
               case 11:
                   month = 'Nov';
                   break;
               case 12:
                   month = 'Dec';
                   break;
           }
           var d = date.getDate();
           return (d < 10 ? ('0' + d) : d) + ' ' + month + ' ' + y;
       }



       function setFullName() {
           $('#txtName').val($('#txtFirstName').val() + ' ' + $('#txtMiddleName').val() + ' ' + $('#txtSurName').val());
           $('#dlgFullName').dialog('close');
       }

       function setHomeAddress() {
           $('#txtHomeAddress').val($('#txtStreet').val() + ' ' + $('#txtSuburb').val() + ' ' + $('#txtState').val() + ' ' + $('#txtPostCode').val());
           $('#dlgHomeAddress').dialog('close');
       }
       function DefaultformatDate(value) {
           dArr = value.split('/');
           return dArr[1] + '/' + dArr[0] + '/' + dArr[2];
       }


       function openDialogNewParty() {
           ResetForm();

           $('#dlgAddParty').dialog({
               title: 'Add Party'
           });
           $('#dlgAddParty').dialog('open');
           TempData();
       }
       $('#txtIncomeType').combobox({
           onSelect: function () {
               if ($('#txtIncomeType').combobox('getValue') == 'Employee') {
                   $('#selfemployed').hide();
                   $('#employee').show();
               }
               else {
                   $('#employee').hide();
                   $('#selfemployed').show();
               }
           }
       });


       function openDialogEditParty() {
           $('#dlgAddParty').dialog({
               title: 'Edit Party'
           });
           var row = $('#dgParties').datagrid('getSelected');
           if (row == null)
               $.messager.alert('Morgan AMS', 'Please select party to Edit ');
           else {
               $('#dlgAddParty').dialog('open');
               selectpartyDetail(row.ContactID);
           }
       }
       function selectpartyDetail(contactid) {

           $.ajax({
               url: "/WebServices/ApplicationContact.ashx?method=ApplicationContactSelect",
               contentType: "application/json; charset=utf-8",
               data: { 'ContactID': contactid },
               success: function (data) {
                   $.each(eval(data.replace(/[\r\n]/, '')), function (i, rec) {
                       $('#hdnContactId').val(rec.ContactID);
                       $('#hdnApp_Id').val(rec.app_id);
                       $('#txtTitle').val(rec.Title);
                       $('#txtName').val(rec.FirstName + ' ' + rec.MiddleName + ' ' + rec.SurName);
                       $('#txtFirstName').val(rec.FirstName);
                       $('#txtMiddleName').val(rec.MiddleName);
                       $('#txtSurName').val(rec.SurName);
                       $('#txtRole').val(rec.Role);
                       $('#txtRelationship').val(rec.Relationship);
                       $('#txtDOB').datebox('setValue', formatDateBirth(rec.DateBirth, null));
                       $('#txtMobilePhone').val(rec.Mobile);
                       $('#txtHomePhone').val(rec.HomePhone);
                       $('#txtWorkPhone').val(rec.WorkPhone);
                       $('#txtFaxNumber').val(rec.FaxNumber);
                       $('#txtEmail1').val(rec.Email);
                       $('#txtEmail2').val(rec.secondEmailAddress);
                       $('#txtHomeAddress').val(rec.Street + ' ' + rec.Suburb + ' ' + rec.State + ' ' + rec.PostCode);
                       $('#txtStreet').val(rec.Street);
                       $('#txtSuburb').val(rec.Suburb);
                       $('#txtState').val(rec.State);
                       $('#txtPostCode').val(rec.PostCode);
                       $('#txtPostalAddress').val(rec.PostalAddress);
                       $('#txtIncomeType').combobox('setValue', rec.IncomeType);
                       $('#hdnIncomeType').val(rec.IncomeType);
                       $('#txtTypeofEntity').val(rec.SelfEmpTypeofEntity);
                       $('#txtBusinessName').val(rec.SelfEmpBusinessName);
                       $('#txtABN').val(rec.SelfEmpABN);
                       $('#txtNatureofBusiness').val(rec.SelfEmpNatureofBusiness);
                       $('#txtPhone').val(rec.SelfEmpPhone);
                       $('#txtAddress').val(rec.SelfEmpAddress);
                       $('#txtEmployer').val(rec.EmpEmployer);
                       $('#txtOccupation').val(rec.EmpOccupation);
                       $('#txtJobPosition').val(rec.EmpJobPosition);
                       $('#txtEmployerPhone').val(rec.EmpEmployerPhone);
                       $('#txtContactPerson').val(rec.EmpContactPerson);
                       $('#txtWorkAddress').val(rec.EmpWorkAddress);
                       $('#txtKinsName').val(rec.KinsName);
                       $('#txtKinsRelationship').val(rec.KinsRelationship);
                       $('#txtContactNumber').val(rec.KinsContactNumber);
                       $('#txtNotes').val(rec.Notes);
                       if (rec.IncomeType == 'Self Employed') {
                           $('#employee').hide();
                           $('#selfemployed').show();
                       }
                       else {
                           $('#selfemployed').hide();
                           $('#employee').show();
                       }
                   });
               }
           });

       }

       function formatLoanDate(value, row) {
           if (value == null)
               return value;
           var date = new Date(value);
           var y = date.getFullYear();
           var m = date.getMonth() + 1;
           var d = date.getDate();
           return (d < 10 ? ('0' + d) : d) + '/' + (m < 10 ? ('0' + m) : m) + '/' + y;
       }
       function savePartyDetails() {
           //window.onbeforeunload = null;
           var ContID = $('#hdnContactId').val();
           var AppID = $('#hdnApp_Id').val();
           var cmbTitle = $('#txtTitle').val();
           var txtFirstName = $('#txtFirstName').val();
           var txtMiddleName = $('#txtMiddleName').val();
           var txtSurName = $('#txtSurName').val();
           var txtRole = $('#txtRole').val();
           var txtRelationship = $('#txtRelationship').val();
           var txtDateBirth = DefaultformatDate($('input[name="DOB"]').val());
           var txtMobilePhone = $('#txtMobilePhone').val();
           var txtHomePhone = $('#txtHomePhone').val();
           var txtWorkPhone = $('#txtWorkPhone').val();
           var txtFaxNumber = $('#txtFaxNumber').val();
           var txtEmail1 = $('#txtEmail1').val();
           var txtEmail2 = $('#txtEmail2').val();
           var txtStreet = $('#txtStreet').val();
           var txtSuburb = $('#txtSuburb').val();
           var cmbState = $('#txtState').val();
           var txtPostCode = $('#txtPostCode').val();
           var txtPostalAddress = $('#txtPostalAddress').val();
           var txtIncomeType = $('#txtIncomeType').combobox('getValue');
           var txtTypeofEntity = $('#txtTypeofEntity').val();
           var txtBusinessName = $('#txtBusinessName').val();
           var txtABN = $('#txtABN').val();
           var txtNatureofBusiness = $('#txtNatureofBusiness').val();
           var txtPhone = $('#txtPhone').val();
           var txtAddress = $('#txtAddress').val();
           var txtEmployer = $('#txtEmployer').val();
           var txtOccupation = $('#txtOccupation').val();
           var txtJobPosition = $('#txtJobPosition').val();
           var txtEmployerPhone = $('#txtEmployerPhone').val();
           var txtContactPerson = $('#txtContactPerson').val();
           var txtWorkAddress = $('#txtWorkAddress').val();
           var txtKinsName = $('#txtKinsName').val();
           var txtKinsRelationship = $('#txtKinsRelationship').val();
           var txtContactNumber = $('#txtContactNumber').val();
           var txtNotes = $('#txtNotes').val();

           if (ContID == '') {
               $.ajax({
                   url: '/WebServices/ApplicationContact.ashx?method=PartiesContactAdd',
                   contentType: "application/json; charset=utf-8",
                   data: { 'AppID': AppID, 'Title': cmbTitle, 'FirstName': txtFirstName, 'MiddleName': txtMiddleName, 'SurName': txtSurName, 'Role': txtRole, 'Relationship': txtRelationship, 'DateBirth': txtDateBirth, 'MobilePhone': txtMobilePhone, 'HomePhone': txtHomePhone, 'WorkPhone': txtWorkPhone, 'FaxNumber': txtFaxNumber, 'secondEmailAddress': txtEmail1, 'Email2': txtEmail2, 'Street': txtStreet, 'Suburb': txtSuburb, 'State': cmbState, 'PostCode': txtPostCode, 'PostalAddress': txtPostalAddress, 'IncomeType': txtIncomeType, 'TypeofEntity': txtTypeofEntity, 'BusinessName': txtBusinessName, 'ABN': txtABN, 'NatureofBusiness': txtNatureofBusiness, 'Phone': txtPhone, 'Address': txtAddress, 'Employer': txtEmployer, 'Occupation': txtOccupation, 'JobPosition': txtJobPosition, 'EmployerPhone': txtEmployerPhone, 'ContactPerson': txtContactPerson, 'WorkAddress': txtWorkAddress, 'KinsName': txtKinsName, 'KinsRelationship': txtKinsRelationship, 'ContactNumber': txtContactNumber, 'Notes': txtNotes },
                   success: function (data) {
                       alert('Party Add Successfully');
                       $('#dgSummary').datagrid('reload');
                   }
               });
           }
           else {
               $.ajax({
                   url: '/WebServices/ApplicationContact.ashx?method=PartiesContactEdit',
                   contentType: "application/json; charset=utf-8",
                   data: { 'ContactID': ContID, 'Title': cmbTitle, 'FirstName': txtFirstName, 'MiddleName': txtMiddleName, 'SurName': txtSurName, 'Role': txtRole, 'Relationship': txtRelationship, 'DateBirth': txtDateBirth, 'MobilePhone': txtMobilePhone, 'HomePhone': txtHomePhone, 'WorkPhone': txtWorkPhone, 'FaxNumber': txtFaxNumber, 'secondEmailAddress': txtEmail1, 'Email2': txtEmail2, 'Street': txtStreet, 'Suburb': txtSuburb, 'State': cmbState, 'PostCode': txtPostCode, 'PostalAddress': txtPostalAddress, 'IncomeType': txtIncomeType, 'TypeofEntity': txtTypeofEntity, 'BusinessName': txtBusinessName, 'ABN': txtABN, 'NatureofBusiness': txtNatureofBusiness, 'Phone': txtPhone, 'Address': txtAddress, 'Employer': txtEmployer, 'Occupation': txtOccupation, 'JobPosition': txtJobPosition, 'EmployerPhone': txtEmployerPhone, 'ContactPerson': txtContactPerson, 'WorkAddress': txtWorkAddress, 'KinsName': txtKinsName, 'KinsRelationship': txtKinsRelationship, 'ContactNumber': txtContactNumber, 'Notes': txtNotes },
                   success: function () {
                       alert('Party Save Successfully');
                       $('#dgSummary').datagrid('reload');

                   }
               });
           }
       }

       function deleteParties() {
           var row = $('#dgParties').datagrid('getSelected');
           if (row == null)
               $.messager.alert('Morgan AMS', 'Please select party to delete ');
           else {
               $.messager.confirm('Morgan CRM', 'Are you sure want to Delete This Party', function (r) {
                   if (r) {
                       $.ajax({
                           url: '/WebServices/ApplicationContact.ashx?method=DeleteParties',
                           data: { 'ContactID': ContID },
                           success: function () {
                               $.messager.alert('Morgan AMS', 'Party  deleted Successlly');
                               $('#dgSummary').datagrid('reload');
                           }
                       });
                   }
               });
           }
       }
       function ResetForm() {
           $('#hdnContactId').val('');
           $('#hdnApp_Id').val('');
           $('#txtTitle').val('');
           $('#txtName').val();
           $('#txtFirstName').val();
           $('#txtMiddleName').val();
           $('#txtSurName').val();
           $('#txtRole').val();
           $('#txtRelationship').val();
           $('#txtDOB').datebox('setValue', formatDateBirth('05/02/2010', null));
           $('#txtMobilePhone').val('');
           $('#txtHomePhone').val('');
           $('#txtWorkPhone').val('');
           $('#txtFaxNumber').val('');
           $('#txtEmail1').val('');
           $('#txtEmail2').val('');
           $('#txtHomeAddress').val('');
           $('#txtStreet').val('');
           $('#txtSuburb').val('');
           $('#txtState').val('');
           $('#txtPostCode').val('');
           $('#txtPostalAddress').val('');
           //$('#txtIncomeType').combobox('setValue', rec.IncomeType);
           //$('#hdnIncomeType').val(rec.IncomeType);
           $('#txtTypeofEntity').val('');
           $('#txtBusinessName').val('');
           $('#txtABN').val('');
           $('#txtNatureofBusiness').val('');
           $('#txtPhone').val('');
           $('#txtAddress').val('');
           $('#txtEmployer').val('');
           $('#txtOccupation').val('');
           $('#txtJobPosition').val('');
           $('#txtEmployerPhone').val('');
           $('#txtContactPerson').val('');
           $('#txtWorkAddress').val('');
           $('#txtKinsName').val('');
           $('#txtKinsRelationship').val('');
           $('#txtContactNumber').val('');
           $('#txtNotes').val('');
       }

       function TempData() {
           $('#txtTitle').val('Mr');
           $('#txtName').val('Jignesh T Patel');
           $('#txtFirstName').val('Jignesh');
           $('#txtMiddleName').val('T');
           $('#txtSurName').val('Patel');
           $('#txtRole').val('Test');
           $('#txtRelationship').val('Test');
           //$('#txtDOB').datebox('setValue', '15/02/2014');
           //$('#txtDOB').datebox('15/02/2014');
           $('#txtMobilePhone').val('9865124563');
           $('#txtHomePhone').val('9865124563');
           $('#txtWorkPhone').val('9865124563');
           $('#txtFaxNumber').val('9865124563');
           $('#txtEmail1').val('jignesh@gmail.com');
           $('#txtEmail2').val('jignesh@yahoo.com');
           $('#txtHomeAddress').val('TestHomeAddress');
           $('#txtStreet').val('TestStreet');
           $('#txtSuburb').val('TestSuburb');
           $('#txtState').val('TestState');
           $('#txtPostCode').val('000000');
           $('#txtPostalAddress').val('TestPostalAddress');
           //$('#txtIncomeType').combobox('setValue', rec.IncomeType);
           //$('#hdnIncomeType').val(rec.IncomeType);
           $('#txtTypeofEntity').val('Test');
           $('#txtBusinessName').val('Test');
           $('#txtABN').val('000-000');
           $('#txtNatureofBusiness').val('Test');
           $('#txtPhone').val('9865124563');
           $('#txtAddress').val('TestAddress');
           $('#txtEmployer').val('TestEmployer');
           $('#txtOccupation').val('TestOccupation');
           $('#txtJobPosition').val('TestJobPosition');
           $('#txtEmployerPhone').val('TestEmployerPhone');
           $('#txtContactPerson').val('TestContactPerson');
           $('#txtWorkAddress').val('TestWorkAddress');
           $('#txtKinsName').val('TestKinsName');
           $('#txtKinsRelationship').val('TestKinsRelationship');
           $('#txtContactNumber').val('9865124563');
           $('#txtNotes').val('Test');
       }
    </script>
</asp:content>
